package com.jack006.api.controller.user;

import com.jack006.grace.result.GraceJSONResult;
import com.jack006.pojo.bo.RegisterLoginBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * @Classname PassportControllerApi
 * @Description 用户登录通信控制类
 * @Date 2021-06-13 10:27
 * @Created by jack
 */
@Api(value = "用户注册登录的 controller", tags = "用户注册登录的 controller")
@RequestMapping("/passport")
public interface PassportControllerApi {

    @ApiOperation(value = "获得短信验证码", notes="获得短信验证码",httpMethod = "GET")
    @GetMapping("/getSMSCode")
    GraceJSONResult getSMSCode(@RequestParam("mobile") String mobile, HttpServletRequest request);

    @ApiOperation(value = "一键注册登录接口", notes="一键注册登录接口",httpMethod = "POST")
    @PostMapping("/doLogin")
    GraceJSONResult doLogin(@Valid @RequestBody RegisterLoginBO registerLoginBO,
                            HttpServletRequest request,
                            HttpServletResponse response);

    @ApiOperation(value = "用户退出登录", notes="用户退出登录",httpMethod = "POST")
    @PostMapping("/logout")
    GraceJSONResult logout(@RequestParam("userId") String userId,
                           HttpServletRequest request,
                           HttpServletResponse response);
}
